package com.minova.demo.service.impl;

import com.minova.demo.entity.TzProd;
import com.minova.demo.entity.TzProdComm;
import com.minova.demo.mapper.TzProdMapper;
import com.minova.demo.service.ITzProdService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 商品 服务实现类
 * </p>
 *
 * @author linrongji
 * @since 2019-12-23
 */
@Service
public class TzProdServiceImpl extends ServiceImpl<TzProdMapper, TzProd> implements ITzProdService {

	@Autowired
	private TzProdMapper tzProdMapper;
	
	@Override
	public List<TzProd> selectTzProdByCid(int cid) {
		// TODO Auto-generated method stub
		return tzProdMapper.selectTzProdByCid(cid);
	}

	@Override
	public List<TzProd> getSearchResult(String str,int descBy) {
		// TODO Auto-generated method stub
		return tzProdMapper.getSearchResult(str,descBy);
	}
	
	private TzProdMapper tzProd;


	
	@Override
	public IPage<TzProd> selectPageVo(String prod_name, String column, String column_id, int page, int size,String byDesc) {
		 Page<TzProd> pages = new Page<>(page, size);
	        return  tzProdMapper.selectPage(pages, new QueryWrapper<TzProd>()
	                .like("prod_name", prod_name).like(column, column_id).orderByDesc(byDesc));
	}

	@Override
	public TzProd selectTzProd(int sTzProdID) {
		// TODO Auto-generated method stub
		return tzProdMapper.selectTzProd(sTzProdID);
	}


}
